home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 68 / IOPROG_68.ISO / soft / Tools / AIProSF / AIProSF.exe / ActiveInstall Professional.msi / Data.cab / fMain.frm_1 (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2003-01-21  |  7.3 KB  |  219 lines

  1. VERSION 5.00
  2. Begin VB.Form fMain 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "WidgetPad"
  5.    ClientHeight    =   6075
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   8490
  9.    BeginProperty Font 
  10.       Name            =   "Tahoma"
  11.       Size            =   8.25
  12.       Charset         =   0
  13.       Weight          =   400
  14.       Underline       =   0   'False
  15.       Italic          =   0   'False
  16.       Strikethrough   =   0   'False
  17.    EndProperty
  18.    LinkTopic       =   "Form1"
  19.    MaxButton       =   0   'False
  20.    MinButton       =   0   'False
  21.    ScaleHeight     =   6075
  22.    ScaleWidth      =   8490
  23.    ShowInTaskbar   =   0   'False
  24.    StartUpPosition =   3  'Windows Default
  25.    Begin VB.ComboBox cboDirectory 
  26.       Height          =   315
  27.       Left            =   1020
  28.       Style           =   2  'Dropdown List
  29.       TabIndex        =   3
  30.       Top             =   60
  31.       Width           =   5955
  32.    End
  33.    Begin VB.CommandButton cmdClose 
  34.       Caption         =   "Close"
  35.       Height          =   375
  36.       Left            =   7080
  37.       TabIndex        =   2
  38.       Top             =   540
  39.       Width           =   1335
  40.    End
  41.    Begin VB.CommandButton cmdOpen 
  42.       Caption         =   "Open..."
  43.       Height          =   375
  44.       Left            =   7080
  45.       TabIndex        =   1
  46.       Top             =   120
  47.       Width           =   1335
  48.    End
  49.    Begin VB.TextBox txtMain 
  50.       Height          =   5595
  51.       Left            =   60
  52.       Locked          =   -1  'True
  53.       MultiLine       =   -1  'True
  54.       ScrollBars      =   2  'Vertical
  55.       TabIndex        =   0
  56.       Top             =   420
  57.       Width           =   6915
  58.    End
  59.    Begin VB.Label Label1 
  60.       Caption         =   "Directory:"
  61.       BeginProperty Font 
  62.          Name            =   "Tahoma"
  63.          Size            =   8.25
  64.          Charset         =   0
  65.          Weight          =   700
  66.          Underline       =   0   'False
  67.          Italic          =   0   'False
  68.          Strikethrough   =   0   'False
  69.       EndProperty
  70.       Height          =   255
  71.       Left            =   120
  72.       TabIndex        =   4
  73.       Top             =   120
  74.       Width           =   855
  75.    End
  76. Attribute VB_Name = "fMain"
  77. Attribute VB_GlobalNameSpace = False
  78. Attribute VB_Creatable = False
  79. Attribute VB_PredeclaredId = True
  80. Attribute VB_Exposed = False
  81. Option Explicit
  82. Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (ofn As OPENFILENAME) As Boolean
  83. Private Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (ofn As OPENFILENAME) As Boolean
  84. Private Type OPENFILENAME
  85.    lStructSize As Long
  86.    hwndOwner As Long
  87.    hInstance As Long
  88.    stFilter As String
  89.    stCustomFilter As String
  90.    nMaxCustFilter As Long
  91.    nFilterIndex As Long
  92.    strFile As String
  93.    nMaxFile As Long
  94.    stFileTitle As String
  95.    nMaxFileTitle As Long
  96.    stInitialDir As String
  97.    strTitle As String
  98.    flags As Long
  99.    nFileOffset As Integer
  100.    nFileExtension As Integer
  101.    stDefExt As String
  102.    lCustData As Long
  103.    lpfnHook As Long
  104.    lpTemplateName As String
  105. End Type
  106. Public Enum OFN_FLAGS
  107.    OFN_READONLY = &H1
  108.    OFN_OVERWRITEPROMPT = &H2
  109.    OFN_HIDEREADONLY = &H4
  110.    OFN_NOCHANGEDIR = &H8
  111.    OFN_SHOWHELP = &H10
  112.    OFN_ENABLEHOOK = &H20
  113.    OFN_ENABLETEMPLATE = &H40
  114.    OFN_ENABLETEMPLATEHANDLE = &H80
  115.    OFN_NOVALIDATE = &H100
  116.    OFN_ALLOWMULTISELECT = &H200
  117.    OFN_EXTENSIONDIFFERENT = &H400
  118.    OFN_PATHMUSTEXIST = &H800
  119.    OFN_FILEMUSTEXIST = &H1000
  120.    OFN_CREATEPROMPT = &H2000
  121.    OFN_SHAREAWARE = &H4000
  122.    OFN_NOREADONLYRETURN = &H8000
  123.    OFN_NOTESTFILECREATE = &H10000
  124.    OFN_NONETWORKBUTTON = &H20000
  125.    OFN_NOLONGNAMES = &H40000
  126.    OFN_EXPLORER = &H80000
  127.    OFN_NODEREFERENCELINKS = &H100000
  128.    OFN_LONGNAMES = &H200000
  129. End Enum
  130. Private Const CATEGORY_ID = "{81EBBF4C-1CDA-4F96-B060-6430D99C6300}"
  131. 'Private Const CATEGORY_ID = "{DC441E1D-3ECB-4DCF-B0A5-791F9C0F4F5B}"
  132. Private Sub cmdClose_Click()
  133.     Unload Me
  134. End Sub
  135. Private Sub cmdOpen_Click()
  136.     Dim sFile As String
  137.     Dim sFilter As String
  138.     sFilter = "Widget Doc Files (*.wdoc)" & Chr$(0) & "*.WDOC" & Chr$(0) & "All Files (*.*)" & Chr$(0) & "*.*" & Chr$(0)
  139.     sFile = FileOpenSave(OFN_NOCHANGEDIR, CurDir$, sFilter, , ".wdoc", , , hwnd, True)
  140.     If Len(sFile) > 0 Then
  141.         OpenDoc sFile
  142.     End If
  143. End Sub
  144. Private Sub Form_Load()
  145.    On Error GoTo Form_Load_Error
  146.     LoadDirectories
  147.     If Command <> "" Then
  148.         OpenDoc Command
  149.     End If
  150.    On Error GoTo 0
  151.    Exit Sub
  152. Form_Load_Error:
  153.     MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Form_Load of Form fMain"
  154. End Sub
  155. Private Sub OpenDoc(FilePath As String)
  156.     Dim oFS As New Scripting.FileSystemObject
  157.     Dim oTS As TextStream
  158.     FilePath = Replace(FilePath, Chr(34), "")
  159.     Set oTS = oFS.OpenTextFile(FilePath, ForReading)
  160.     txtMain.Text = oTS.ReadAll
  161.     oTS.Close
  162. End Sub
  163. Public Function FileOpenSave(Optional ByRef flags As Long = 0&, Optional ByVal InitialDir As Variant, Optional ByVal Filter As String = vbNullString, Optional ByVal FilterIndex As Long = 1, Optional ByVal DefaultExt As String = vbNullString, Optional ByVal FileName As String = vbNullString, Optional ByVal DialogTitle As String = vbNullString, Optional ByVal hwnd As Long = -1, Optional ByVal OpenFile As Boolean = True) As String
  164.     Dim ofn As OPENFILENAME
  165.     Dim stFileName As String
  166.     Dim stFileTitle As String
  167.     Dim fResult As Boolean
  168.     ' Give the dialog a caption title.
  169.     If IsMissing(InitialDir) Then InitialDir = CurDir
  170.     If (hwnd = -1) Then hwnd = 0
  171.     ' Allocate string space for the returned strings.
  172.     stFileName = Left$(FileName & String$(256, vbNullChar), 256)
  173.     stFileTitle = String$(256, vbNullChar)
  174.     With ofn
  175.         .lStructSize = Len(ofn)
  176.         .hwndOwner = hwnd
  177.         .stFilter = Filter
  178.         .nFilterIndex = FilterIndex
  179.         .strFile = stFileName
  180.         .nMaxFile = Len(stFileName)
  181.         .stFileTitle = stFileTitle
  182.         .nMaxFileTitle = Len(stFileTitle)
  183.         .strTitle = DialogTitle
  184.         .flags = flags
  185.         .stDefExt = DefaultExt
  186.         .stInitialDir = InitialDir
  187.         .hInstance = 0
  188.         .stCustomFilter = String$(255, vbNullChar)
  189.         .nMaxCustFilter = 255
  190.         .lpfnHook = 0
  191.     End With
  192.     If OpenFile Then
  193.         fResult = GetOpenFileName(ofn)
  194.     Else
  195.         fResult = GetSaveFileName(ofn)
  196.     End If
  197.     If fResult Then
  198.         flags = ofn.flags
  199.         FileOpenSave = Left$(ofn.strFile, InStr(1, ofn.strFile, vbNullChar, vbBinaryCompare) - 1)
  200.     End If
  201. End Function
  202. Private Sub LoadDirectories()
  203.     Dim oWI As Installer
  204.     Dim sTmp As Variant
  205.     Set oWI = CreateObject("WindowsInstaller.Installer")
  206.     cboDirectory.Clear
  207.     For Each sTmp In oWI.ComponentQualifiers(CATEGORY_ID)
  208.         cboDirectory.AddItem oWI.QualifierDescription(CATEGORY_ID, sTmp)
  209.     Next
  210. End Sub
  211. Private Sub cboDirectory_Click()
  212.     Dim oWI As Installer
  213.     Dim sTmp As String
  214.     Set oWI = CreateObject("WindowsInstaller.Installer")
  215.     sTmp = oWI.ComponentQualifiers(CATEGORY_ID).Item(cboDirectory.ListIndex)
  216.     sTmp = oWI.ProvideQualifiedComponent(CATEGORY_ID, sTmp, 0)
  217.     If sTmp <> "" Then OpenDoc sTmp
  218. End Sub
  219.